﻿using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.RecurringJobs;
using NP.BPMReportPlatform.Reports.CXYXTHNRA.Dtos;
using NP.BPMReportPlatform.Reports.CXYXTHNRA;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using NP.BPMReportPlatform.Reports.MaterialCheckPlanChange.Dtos;
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using NP.BPMReportPlatform.Reports.DailyCloseBook.Dtos;

namespace NP.BPMReportPlatform.Reports.MaterialCheckPlanChange
{
    //[Authorize]
    [ApiController]
    [Route("api/Reports/MaterialCheckPlanChange")]
    public class MaterialCheckPlanChangeController
    {
        private readonly IMaterialCheckPlanChangeService _service;
        public MaterialCheckPlanChangeController(IMaterialCheckPlanChangeService service)
        {
            _service = service;
        }

        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("GetAllAsync")]
        public async Task<PagedResultDto<MaterialCheckPlanChangeOutput>> GetAllAsync([FromBody] MaterialCheckPlanChangeInput input)
        {
            return await _service.GetAllAsync(input);
        }

        /// <summary>
        /// 要货申请报表导出
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ExportExcel")]
        public async Task<XlsxFileResult<MaterialCheckPlanChangeOutput>> ExportExcel([FromBody] MaterialCheckPlanChangeInput input)
        {
            var rst = await _service.ExportAsync(input);
            return new XlsxFileResult<MaterialCheckPlanChangeOutput>(rst, "导出Excel");
        }

        [HttpPost("FixData")]
        public void FixData()
        {
            _service.FixData();
        }
    }
}
